package com.mz.ozy.adapter;

import android.text.TextUtils;
import android.widget.ImageView;

import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mz.ozy.R;
import com.mz.ozy.bean.ExchangeOrderBean;
import com.mz.ozy.bean.VirtualOrderBean;
import com.mz.ozy.utils.glideUtils.GlideUtils;

import org.jetbrains.annotations.NotNull;

import java.util.List;

/**
 * Created by Administrator on 2018/11/20.
 */

public class ExchangeOrderAdapter extends BaseQuickAdapter<ExchangeOrderBean, BaseViewHolder> {

    public ExchangeOrderAdapter(@Nullable List<ExchangeOrderBean> data) {
        super(R.layout.view_item_submit_order, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ExchangeOrderBean item) {
        ImageView ivIcon = helper.getView(R.id.iv_only_goods_icon);
        String img_zt = "";
        if (!TextUtils.isEmpty(item.getImg_zt())) {
            final String[] splitImgZt = item.getImg_zt().split(",");
            if (splitImgZt.length > 0) {
                img_zt = splitImgZt[0];
            }
        }
        GlideUtils.loadRoundImg(mContext, ivIcon, img_zt, R.mipmap.default_foods_icon, 4);
        if (!TextUtils.isEmpty(item.getTradname())) {
            helper.setText(R.id.tv_only_goods_title, item.getTradname());
        } else {
            helper.setText(R.id.tv_only_goods_title, "");
        }
        helper.setText(R.id.tv_only_goods_info, item.getGname());
        helper.setText(R.id.tv_goods_price, "¥" + item.getPrice());
        helper.setText(R.id.tv_count, "×1");
    }
}
